Repository navigation
diag(qt): IME 事件与提交字节观测 (#155) - #207
Conversation
c636448 to
57df48a
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Records kind and UTF-8 bytes for preedit, commit and cancel so a fixed-IME run can show what the widget delivered without changing the send path.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57df48a8e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (preedit != preedit_) { preedit_ = preedit; update(); } | ||
| if (preedit != preedit_) { | ||
| if (!preedit.isEmpty()) ime_log("preedit", preedit); | ||
| else if (!preedit_.isEmpty()) ime_log("cancel", QString()); |
There was a problem hiding this comment.
Distinguish composition commits from cancellations in the log
When logging is enabled, committing an active composition with an empty preedit and nonempty commit string produces both a cancel record and a commit record for the same event. This occurs in the existing src/qt/shell_smoke.cpp sequence that sends composing followed by committed; no cancellation actually occurs. Consequently, the diagnostic output cannot reliably distinguish successful composition completion from cancellation, undermining the IME evidence this change is intended to collect. Check the commit string before classifying an empty preedit as cancellation, or record the event's preedit and commit fields together without inferring a cancellation.
Useful? React with 👍 / 👎.
…#155 The caret cell is what the IME uses to place its candidate window, so the log now carries row, column, widget-relative caret rectangle and the widget global origin for each event.
内容
给 Qt 终端加可选的 IME 观测(默认关闭,未设置的运行不写任何文件):
TERMFORGE_QT_IME_LOG指定 JSONL 路径;inputMethodEvent记录一行:kind(preedit / commit / cancel)、bytes、UTF-8 十六进制;真机验证(隔离 VM,固定微软拼音,我们的 Qt 应用)
把应用部署到 VM 后聚焦窗口,用
keybd_event发送 n i h a o 与空格选择候选,得到完整序列:{"kind":"preedit","bytes":1,"utf8":"6e"} {"kind":"preedit","bytes":2,"utf8":"6e69"} {"kind":"preedit","bytes":4,"utf8":"6e692768"} {"kind":"preedit","bytes":5,"utf8":"6e69276861"} {"kind":"preedit","bytes":6,"utf8":"6e692768616f"} {"kind":"cancel","bytes":0,"utf8":""} {"kind":"commit","bytes":6,"utf8":"e4bda0e5a5bd"}逐行含义:组合串从 n 增长到 ni'hao(
6e692768616f),随后组合被清空(cancel),最后提交「你好」(e4bda0e5a5bd)。即:真实系统输入法在我们的应用里完成了组合 → 取消 → 提交,且提交的正是 UTF-8 的「你好」。
边界
Refs #155